home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1995 November / Macworld Nov ’95.toast / Comms / HTML / A Beginner's Guide to HTML next >
Encoding:
Text File  |  1995-09-09  |  30.4 KB  |  903 lines  |  [TEXT/ttxt]

  1. A Beginner's Guide to HTML
  2.  
  3. This is a primer for producing documents in HTML, the markup language used
  4. by the World Wide Web.
  5.  
  6.    * Acronym Expansion
  7.    * What This Primer Doesn't Cover
  8.    * Creating HTML Documents
  9.         o The Minimal HTML Document
  10.         o Basic Markup Tags
  11.              + Titles
  12.              + Headings
  13.              + Paragraphs
  14.         o Linking to Other Documents
  15.              + Relative Links Versus Absolute Pathnames
  16.              + Uniform Resource Locator
  17.              + Anchors to Specific Sections in Other Documents
  18.              + Anchors to Specific Sections Within the Current Document
  19.    * Additional Markup Tags
  20.         o Lists
  21.              + Unnumbered Lists
  22.              + Numbered Lists
  23.              + Definition Lists
  24.              + Nested Lists
  25.         o Preformatted Text
  26.         o Extended Quotes
  27.         o Addresses
  28.    * Character Formatting
  29.         o Physical Versus Logical: Use Logical Tags When Possible
  30.              + Logical Styles
  31.              + Physical Styles
  32.         o Using Character Tags
  33.         o Special Characters
  34.              + Escape Sequences
  35.              + Forced Line Breaks
  36.              + Horizontal Rules
  37.    * In-line Images
  38.         o Alternate Text for Viewers That Can't Display Images
  39.    * External Images, Sounds, and Animations
  40.    * Troubleshooting
  41.         o Avoid Overlapping Tags
  42.         o Embed Anchors and Character Tags, But Not Anything Else
  43.         o Check Your Links
  44.    * A Longer Example
  45.    * For More Information
  46.         o Fill-out Forms
  47.         o Style Guides
  48.         o Other Introductory Documents
  49.         o Additional References
  50.  
  51. Acronym Expansion
  52.  
  53. WWW  World Wide Web (or Web, for short).
  54. SGML
  55.      Standard Generalized Markup Language -- this is a standard for
  56.      describing markup languages.
  57. DTD  Document Type Definition -- this is a specific markup language, written
  58.      using SGML.
  59. HTML
  60.      HyperText Markup Language -- HTML is a SGML DTD. In practical terms,
  61.      HTML is a collection of styles (indicated by markup tags) that define
  62.      the various components of a World Wide Web document. HTML was invented
  63.      by Tim Berners-Lee while at CERN. He is now director of the W3
  64.      Consortium.
  65.  
  66. What This Primer Doesn't Cover
  67.  
  68. This primer assumes that you have:
  69.  
  70.    * at least a passing knowledge of how to use NCSA Mosaic or some other
  71.      Web browser
  72.    * a general understanding of how Web servers and client browsers work
  73.    * access to a Web server for which you would like to produce HTML
  74.      documents, or that you wish to produce HTML documents for personal use
  75.  
  76. Creating HTML Documents
  77.  
  78. HTML documents are in plain (also known as ASCII) text format and can be
  79. created using any text editor (e.g., Emacs or vi on UNIX machines). A couple
  80. of Web browsers (tkWWW for X Window System machines and CERN's Web browser
  81. for NeXT computers) include rudimentary HTML editors in a WYSIWYG
  82. environment. There are also some WYSIWIG editors available now (e.g.
  83. HotMetal for Sun Sparcstations, HTML Edit for Macintoshes). You may wish to
  84. try one of them first before delving into the details of HTML.
  85.  
  86.      You can preview a document in progress with NCSA Mosaic (and some
  87.      other Web browsers). Open it with the Open Local command under the
  88.      File menu.
  89.  
  90.      After you edit the source HTML file, save the changes. Return to
  91.      NCSA Mosaic and Reload the document. The changes are reflected in
  92.      the on-screen display.
  93.  
  94. The Minimal HTML Document
  95.  
  96. Here is a bare-bones example of HTML:
  97.  
  98.     <TITLE>The simplest HTML example</TITLE>
  99.     <H1>This is a level-one heading</H1>
  100.     Welcome to the world of HTML.
  101.     This is one paragraph.<P>
  102.     And this is a second.<P>
  103.  
  104. Click here to see the formatted version of the example.
  105.  
  106. HTML uses markup tags to tell the Web browser how to display the text. The
  107. above example uses:
  108.  
  109.    * the <TITLE> tag (and corresponding </TITLE> tag), which specifies the
  110.      title of the document
  111.    * the <H1> header tag (and corresponding </H1>)
  112.    * the <P> paragraph-separator tag
  113.  
  114. HTML tags consist of a left angle bracket (<), (a ``less than'' symbol to
  115. mathematicians), followed by name of the tag and closed by a right angular
  116. bracket (>). Tags are usually paired, e.g. <H1> and </H1>. The ending tag
  117. looks just like the starting tag except a slash (/) precedes the text within
  118. the brackets. In the example, <H1> tells the Web browser to start formatting
  119. a level-one heading; </H1> tells the browser that the heading is complete.
  120.  
  121. The primary exception to the pairing rule is the <P> tag. There is no such
  122. thing as </P>.
  123.  
  124. NOTE: HTML is not case sensitive. <title> is equivalent to <TITLE> or
  125. <TiTlE>.
  126.  
  127. Not all tags are supported by all World Wide Web browsers. If a browser does
  128. not support a tag, it just ignores it.
  129.  
  130. Basic Markup Tags
  131.  
  132. Title
  133.  
  134. Every HTML document should have a title. A title is generally displayed
  135. separately from the document and is used primarily for document
  136. identification in other contexts (e.g., a WAIS search). Choose about half a
  137. dozen words that describe the document's purpose.
  138.  
  139.      In the X Window System and Microsoft Windows versions of NCSA
  140.      Mosaic, the Document Title field is at the top of the screen just
  141.      below the pulldown menus. In NCSA Mosaic for Macintosh, text
  142.      tagged as <TITLE> appears as the window title.
  143.  
  144. Headings
  145.  
  146. HTML has six levels of headings, numbered 1 through 6, with 1 being the most
  147. prominent. Headings are displayed in larger and/or bolder fonts than normal
  148. body text. The first heading in each document should be tagged <H1>. The
  149. syntax of the heading tag is:
  150.  
  151. <Hy>Text of heading </Hy >
  152.  
  153. where y is a number between 1 and 6 specifying the level of the heading.
  154.  
  155. For example, the coding for the ``Headings'' section heading above is
  156.  
  157.     <H3>Headings</H3>
  158.  
  159. Title versus first heading
  160.  
  161. In many documents, the first heading is identical to the title. For
  162. multipart documents, the text of the first heading should be suitable for a
  163. reader who is already browsing related information (e.g., a chapter title),
  164. while the title tag should identify the document in a wider context (e.g.,
  165. include both the book title and the chapter title, although this can
  166. sometimes become overly long).
  167.  
  168. Paragraphs
  169.  
  170. Unlike documents in most word processors, carriage returns in HTML files
  171. aren't significant. Word wrapping can occur at any point in your source
  172. file, and multiple spaces are collapsed into a single space. (There are
  173. couple of exceptions; space following a <P> or <Hy> tag, for example, is
  174. ignored.) Notice that in the bare-bones example, the first paragraph is
  175. coded as
  176.  
  177.     Welcome to HTML.
  178.     This is the first paragraph. <P>
  179.  
  180. In the source file, there is a line break between the sentences. A Web
  181. browser ignores this line break and starts a new paragraph only when it
  182. reaches a <P> tag.
  183.  
  184. Important: You must separate paragraphs with <P>. The browser ignores any
  185. indentations or blank lines in the source text. HTML relies almost entirely
  186. on the tags for formatting instructions, and without the <P> tags, the
  187. document becomes one large paragraph. (The exception is text tagged as
  188. ``preformatted,'' which is explained below.) For instance, the following
  189. would produce identical output as the first bare-bones HTML example:
  190.  
  191.     <TITLE>The simplest HTML example</TITLE><H1>This is a level
  192.     one heading</H1>Welcome to the world of HTML. This is one
  193.     paragraph.<P>And this is a second.<P>
  194.  
  195. However, to preserve readability in HTML files, headings should be on
  196. separate lines, and paragraphs should be separated by blank lines (in
  197. addition to the <P> tags).
  198.  
  199.      NCSA Mosaic handles <P> by ending the current paragraph and
  200.      inserting a blank line.
  201.  
  202. In HTML+, a successor to HTML currently in development, <P> becomes a
  203. ``container'' of text, just as the text of a level-one heading is
  204. ``contained'' within<H1> ... </H1>:
  205.  
  206.     <P>
  207.     This is a paragraph in HTML+.
  208.     </P>
  209.  
  210. The difference is that the </P> closing tag can always be omitted. (That is,
  211. if a browser sees a <P>, it knows that there must be an implied </P> to end
  212. the previous paragraph.) In other words, in HTML+, <P> is a
  213. beginning-of-paragraph marker.
  214.  
  215. The advantage of this change is that you will be able to specify formatting
  216. options for a paragraph. For example, in HTML+, you will be able to center a
  217. paragraph by coding
  218.  
  219.     <P ALIGN=CENTER>
  220.     This is a centered paragraph. This is HTML+, so you can't do it yet.
  221.  
  222. This change won't effect any documents you write now, and they will continue
  223. to look just the same with HTML+ browsers.
  224.  
  225. Linking to Other Documents
  226.  
  227. The chief power of HTML comes from its ability to link regions of text (and
  228. also images) to another document. The browser highlights these regions
  229. (usually with color and/or underlines) to indicate that they are hypertext
  230. links (often shortened to hyperlinks or simply links).
  231.  
  232. HTML's single hypertext-related tag is <A>, which stands for anchor. To
  233. include an anchor in your document:
  234.  
  235.   1. Start the anchor with <A . (There's a space after the A.)
  236.   2. Specify the document that's being pointed to by entering the parameter
  237.      HREF="filename" followed by a closing right angle bracket: >
  238.   3. Enter the text that will serve as the hypertext link in the current
  239.      document.
  240.   4. Enter the ending anchor tag: </A>.
  241.  
  242. Here is an sample hypertext reference:
  243.  
  244.     <A HREF="MaineStats.html">Maine</A>
  245.  
  246. This entry makes the word ``Maine'' the hyperlink to the document
  247. MaineStats.html, which is in the same directory as the first document. You
  248. can link to documents in other directories by specifying the relative path
  249. from the current document to the linked document. For example, a link to a
  250. file NJStats.html located in the subdirectory AtlanticStates would be:
  251.  
  252.     <A HREF="AtlanticStates/NJStats.html">New Jersey</A>
  253.  
  254. These are called relative links. You can also use the absolute pathname of
  255. the file if you wish. Pathnames use the standard UNIX syntax.
  256.  
  257. Relative Links Versus Absolute Pathnames
  258.  
  259. In general, you should use relative links, because
  260.  
  261.   1. You have less to type.
  262.   2. It's easier to move a group of documents to another location, because
  263.      the relative path names will still be valid.
  264.  
  265. However, use absolute pathnames when linking to documents that are not
  266. directly related. For example, consider a group of documents that comprise a
  267. user manual. Links within this group should be relative links. Links to
  268. other documents (perhaps a reference to related software) should use full
  269. path names. This way, if you move the user manual to a different directory,
  270. none of the links would have to be updated.
  271.  
  272. Uniform Resource Locator
  273.  
  274. The World Wide Web uses Uniform Resource Locators (URLs) to specify the
  275. location of files on other servers. A URL includes the type of resource
  276. being accessed (e.g., gopher, WAIS), the address of the server, and the
  277. location of the file. The syntax is:
  278.  
  279. scheme://host.domain[:port]/path/filename
  280.  
  281. where scheme is one of
  282.  
  283. file
  284.      a file on your local system, or a file on an anonymous FTP server
  285. http
  286.      a file on a World Wide Web server
  287. gopher
  288.      a file on a Gopher server
  289. WAIS
  290.      a file on a WAIS server
  291. news
  292.      an Usenet newsgroup
  293. telnet
  294.      a connection to a Telnet-based service
  295.  
  296. The port number can generally be omitted. (That means unless someone tells
  297. you otherwise, leave it out.)
  298.  
  299. For example, to include a link to this primer in your document, you would
  300. use
  301.  
  302.     <A HREF = "http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html">
  303.     NCSA's Beginner's Guide to HTML</A>
  304.  
  305. This would make the text ``NCSA's Beginner's Guide to HTML'' a hyperlink to
  306. this document.
  307.  
  308. For more information on URLs, look at
  309.  
  310.    *  WWW Names and Addresses, URIs, URLs, URNs, written by people at CERN
  311.    *  A Beginner's Guide to URLs, located on the NCSA Mosaic Help menu
  312.  
  313. Links to Specific Sections in Other Documents
  314.  
  315. Anchors can also be used to move to a particular section in a document.
  316. Suppose you wish to set a link from document A and a specific section in
  317. document B. (Call this file documentB.html.) First you need to set up a
  318. named anchor in document B. For example, to set up an anchor named
  319. ``Jabberwocky'' to document B, enter
  320.  
  321.     Here's <A NAME = "Jabberwocky">some text</a>
  322.  
  323. Now when you create the link in document A, include not only the filename,
  324. but also the named anchor, separated by a hash mark (#).
  325.  
  326.     This is my <A HREF = "documentB.html#Jabberwocky">link</A> to document B.
  327.  
  328. Now clicking on the word ``link'' in document A sends the reader directly to
  329. the words ``some text'' in document B.
  330.  
  331. Links to Specific Sections Within the Current Document
  332.  
  333. The technique is exactly the same except the filename is omitted.
  334.  
  335. For example, to link to the Jabberwocky anchor from within the same file
  336. (Document B), use
  337.  
  338.     This is <A HREF = "#Jabberwocky">Jabberwocky link</A> from within Document B.
  339.  
  340. Additional Markup Tags
  341.  
  342. The preceding is sufficient to produce simple HTML documents. For more
  343. complex documents, HTML has tags for several types of lists, preformatted
  344. sections, extended quotations, character formatting, and other items.
  345.  
  346. Lists
  347.  
  348. HTML supports unnumbered, numbered, and definition lists.
  349.  
  350. Unnumbered Lists
  351.  
  352. To make an unnumbered list,
  353.  
  354.   1. Start with an opening list <UL> tag.
  355.   2. Enter the <LI> tag followed by the individual item. (No closing </LI>
  356.      tag is needed.)
  357.   3. End with a closing list </UL> tag.
  358.  
  359. Below an example two-item list:
  360.  
  361.     <UL>
  362.     <LI> apples
  363.     <LI> bananas
  364.     </UL>
  365.  
  366. The output is:
  367.  
  368.    * apples
  369.    * bananas
  370.  
  371. The <LI> items can contain multiple paragraphs. Just separate the paragraphs
  372. with the <P> paragraph tags.
  373.  
  374. Numbered Lists
  375.  
  376. A numbered list (also called an ordered list, from which the tag name
  377. derives) is identical to an unnumbered list, except it uses <OL> instead of
  378. <UL>. The items are tagged using the same <LI> tag. The following HTML code
  379.  
  380.     <OL>
  381.     <LI> oranges
  382.     <LI> peaches
  383.     <LI> grapes
  384.     </OL>
  385.  
  386. produces this formatted output:
  387.  
  388.   1. oranges
  389.   2. peaches
  390.   3. grapes
  391.  
  392. Definition Lists
  393.  
  394. A definition list usually consists of alternating a term (abbreviated as DT)
  395. and a definition (abbreviated as DD). Web browsers generally format the
  396. definition on a new line.
  397.  
  398. The following is an example of a definition list:
  399.  
  400.     <DL>
  401.     <DT> NCSA
  402.     <DD> NCSA, the National Center for Supercomputing Applications,
  403.          is located on the campus of the University of Illinois
  404.          at Urbana-Champaign. NCSA is one of the participants in the
  405.          National MetaCenter for Computational Science and Engineering.
  406.     <DT> Cornell Theory Center
  407.     <DD> CTC is located on the campus of Cornell University in Ithaca,
  408.          New York. CTC is another participant in the National MetaCenter
  409.          for Computational Science and Engineering.
  410.     </DL>
  411.  
  412. The output looks like:
  413.  
  414. NCSA
  415.      NCSA, the National Center for Supercomputing Applications, is located
  416.      on the campus of the University of Illinois at Urbana-Champaign. NCSA
  417.      is one of the participants in the National MetaCenter for Computational
  418.      Science and Engineering.
  419. Cornell Theory Center
  420.      CTC is located on the campus of Cornell University in Ithaca, New York.
  421.      CTC is another participant in the National MetaCenter for Computational
  422.      Science and Engineering.
  423.  
  424. The <DT> and <DD> entries can contain multiple paragraphs (separated by <P>
  425. paragraph tags), lists, or other definition information.
  426.  
  427. Nested Lists
  428.  
  429. Lists can be arbitrarily nested, although in practice you probably should
  430. limit the nesting to three levels. You can also have a number of paragraphs,
  431. each containing a nested list, in a single list item.
  432.  
  433. An example nested list:
  434.  
  435.     <UL>
  436.     <LI> A few New England states:
  437.         <UL>
  438.         <LI> Vermont
  439.         <LI> New Hampshire
  440.         </UL>
  441.     <LI> One Midwestern state:
  442.         <UL>
  443.         <LI> Michigan
  444.         </UL>
  445.     </UL>
  446.  
  447. The nested list is displayed as
  448.  
  449.    * A few New England states:
  450.         o Vermont
  451.         o New Hampshire
  452.    * One Midwestern state:
  453.         o Michigan
  454.  
  455. Preformatted Text
  456.  
  457. Use the <PRE> tag (which stands for ``preformatted'') to generate text in a
  458. fixed-width font and cause spaces, new lines, and tabs to be significant.
  459. (That is, multiple spaces are displayed as multiple spaces, and lines break
  460. in the same locations as in the source HTML file.) This is useful for
  461. program listings. For example, the following lines
  462.  
  463.     <PRE>
  464.       #!/bin/csh
  465.       cd $SCR
  466.       cfs get mysrc.f:mycfsdir/mysrc.f
  467.       cfs get myinfile:mycfsdir/myinfile
  468.       fc -02 -o mya.out mysrc.f
  469.       mya.out
  470.       cfs save myoutfile:mycfsdir/myoutfile
  471.       rm *
  472.     </PRE>
  473.  
  474. display as
  475.  
  476.       #!/bin/csh
  477.       cd $SCR
  478.       cfs get mysrc.f:mycfsdir/mysrc.f
  479.       cfs get myinfile:mycfsdir/myinfile
  480.       fc -02 -o mya.out mysrc.f
  481.       mya.out
  482.       cfs save myoutfile:mycfsdir/myoutfile
  483.       rm *
  484.  
  485. Hyperlinks can be used within <PRE> sections. You should avoid using other
  486. HTML tags within <PRE> sections, however.
  487.  
  488. Note that because <, >, and & have special meaning in HTML, you have to use
  489. their escape sequences (<, >, and &, respectively) to enter these
  490. characters. See the section Special Characters for more information.
  491.  
  492. Extended Quotations
  493.  
  494. Use the <BLOCKQUOTE> tag to include quotations in a separate block on the
  495. screen. Most browsers generally indent to separate it from surrounding text.
  496.  
  497. An example:
  498.  
  499.     <BLOCKQUOTE>
  500.     I still have a dream. It is a dream deeply rooted in the
  501.     American dream. <P>
  502.     I have a dream that one day this nation will rise up and
  503.     live out the true meaning of its creed. We hold these truths
  504.     to be self-evident that all men are created equal. <P>
  505.     </BLOCKQUOTE>
  506.  
  507. The result is:
  508.  
  509.      I still have a dream. It is a dream deeply rooted in the American
  510.      dream.
  511.  
  512.      I have a dream that one day this nation will rise up and live out
  513.      the true meaning of its creed. We hold these truths to be
  514.      self-evident that all men are created equal.
  515.  
  516. Addresses
  517.  
  518. The <ADDRESS> tag is generally used to specify the author of a document and
  519. a means of contacting the author (e.g., an email address). This is usually
  520. the last item in a file.
  521.  
  522. For example, the last line of the online version of this guide is
  523.  
  524.     <ADDRESS>
  525.     A Beginner's Guide to HTML / NCSA / pubs@ncsa.uiuc.edu
  526.     </ADDRESS>
  527.  
  528. The result is
  529. A Beginner's Guide to HTML / NCSA / pubs@ncsa.uiuc.edu
  530.  
  531. NOTE: <ADDRESS> is not used for postal addresses. See ``Forced Line Breaks''
  532. on page 10 to see how to format postal addresses.
  533.  
  534. Character Formatting
  535.  
  536. You can code individual words or sentences with special styles. There are
  537. two types of styles: logical and physical. Logical styles tag text according
  538. to its meaning, while physical styles specify the specific appearance of a
  539. section. For example, in the preceding sentence, the words ``logical
  540. styles'' was tagged as a ``definition.'' The same effect (formatting those
  541. words in italics), could have been achieved via a different tag that
  542. specifies merely ``put these words in italics.''
  543.  
  544. Physical Versus Logical: Use Logical Styles When Possible
  545.  
  546. If physical and logical styles produce the same result on the screen, why
  547. are there both? We devolve, for a couple of paragraphs, into the philosophy
  548. of SGML, which can be summed in a Zen-like mantra: ``Trust your browser.''
  549.  
  550. In the ideal SGML universe, content is divorced from presentation. Thus,
  551. SGML tags a level-one heading as a level-one heading, but does not specify
  552. that the level-one heading should be, for instance, 24-point bold Times
  553. centered on the top of a page. The advantage of this approach (it's similar
  554. in concept to style sheets in many word processors) is that if you decide to
  555. change level-one headings to be 20-point left-justified Helvetica, all you
  556. have to do is change the definition of the level-one heading in the
  557. presentation device (i.e., your World Wide Web browser).
  558.  
  559. The other advantage of logical tags is that they help enforce consistency in
  560. your documents. It's easier to tag something as <H1> than to remember that
  561. level-one headings are 24-point bold Times or whatever. The same is true for
  562. character styles. For example, consider the <STRONG> tag. Most browsers
  563. render it in bold text. However, it is possible that a reader would prefer
  564. that these sections be displayed in red instead. Logical styles offer this
  565. flexibility.
  566.  
  567. Logical Styles
  568.  
  569. <DFN>
  570.      for a word being defined. Typically displayed in italics. (NCSA Mosaic
  571.      is a World Wide Web browser.)
  572. <EM>
  573.      for emphasis. Typically displayed in italics. (Watch out for
  574.      pickpockets.)
  575. <CITE>
  576.      for titles of books, films, etc. Typically displayed in italics. (A
  577.      Beginner's Guide to HTML)
  578. <CODE>
  579.      for snippets of computer code. Displayed in a fixed-width font. (The
  580.      <stdio.h> header file)
  581. <KBD>
  582.      for user keyboard entry. Should be displayed in a bold fixed-width
  583.      font, but many browsers render it in the plain fixed-width font. (Enter
  584.      passwd to change your password.)
  585. <SAMP>
  586.      for computer status messages. Displayed in a fixed-width font.
  587.      (Segmentation fault: Core dumped.)
  588. <STRONG>
  589.      for strong emphasis. Typically displayed in bold. (Important)
  590. <VAR>
  591.      for a ``metasyntactic'' variable, where the user is to replace the
  592.      variable with a specific instance. Typically displayed in italics. (rm
  593.      filename deletes the file.)
  594.  
  595. Physical Styles
  596.  
  597. <B>  bold text
  598. <I>  italic text
  599. <TT>
  600.      typewriter text, e.g. fixed-width font.
  601.  
  602. Using Character Tags
  603.  
  604. To apply a character style,
  605.  
  606.   1. Start with <tag>, where tag is the desired character formatting tag, to
  607.      indicate the beginning of the tagged text.
  608.   2. Enter the tagged text.
  609.   3. End the passage with </tag>.
  610.  
  611. Special Characters
  612.  
  613. Escape Sequences
  614.  
  615. Four characters of the ASCII character set -- the left angle bracket (<),
  616. the right angle bracket (>), the ampersand (&) and the double quote (") --
  617. have special meaning within HTML and therefore cannot be used ``as is'' in
  618. text. (The angle brackets are used to indicate the beginning and end of HTML
  619. tags, and the ampersand is used to indicate the beginning of an escape
  620. sequence.)
  621.  
  622. To use one of these characters in an HTML document, you must enter its
  623. escape sequence instead:
  624.  
  625. <
  626.      the escape sequence for <
  627. >
  628.      the escape sequence for >
  629. &
  630.      the escape sequence for &
  631. "
  632.      the escape sequence for "
  633.  
  634. Additional escape sequences support accented characters. For example:
  635.  
  636. ö
  637.      the escape sequence for a lowercase o with an umlaut: ö
  638. ñ
  639.      the escape sequence for a lowercase n with an tilde: ñ
  640. È
  641.      the escape sequence for an uppercase E with a grave accent: È
  642.  
  643. A full list of supported characters is available.
  644.  
  645. NOTE: Unlike the rest of HTML, the escape sequences are case sensitive. You
  646. cannot, for instance, use < instead of <.
  647.  
  648. Forced Line Breaks
  649.  
  650. The <BR> tag forces a line break with no extra space between lines. (By
  651. contrast, most browsers format the <P> paragraph tag with an additional
  652. blank line to more clearly indicate the beginning the new paragraph.)
  653.  
  654. One use of <BR> is in formatting addresses:
  655.  
  656.     National Center for Supercomputing Applications<BR>
  657.     605 East Springfield Avenue<BR>
  658.     Champaign, Illinois 61820-5518<BR>
  659.  
  660. Horizontal Rules
  661.  
  662. The <HR> tag produces a horizontal line the width of the browser window.
  663.  
  664. In-line Images
  665.  
  666. Most Web browsers can display in-line images (that is, images next to text)
  667. that are in X Bitmap (XBM) or GIF format. Each image takes time to process
  668. and slows down the initial display of the document, so generally you should
  669. not include too many or overly large images.
  670.  
  671. To include an in-line image, use
  672.  
  673.     <IMG SRC=image_URL>
  674.  
  675. where image_URL is the URL of the image file. The syntax for IMG SRC URLs is
  676. identical to that used in an anchor HREF. If the image file is a GIF file,
  677. then the filename part of image_URL must end with .gif. Filenames of X
  678. Bitmap images must end with .xbm.
  679.  
  680.   By default the bottom of an image is aligned with the text as shown in
  681. this paragraph.
  682.  
  683.    Add the ALIGN=TOP option if you want the browser to align adjacent text
  684. with the top of the image as shown in this paragraph. The full in-line image
  685. tag with the top alignment is:
  686.  
  687.     <IMG ALIGN=top SRC=image_URL>
  688.  
  689.    ALIGN=MIDDLE aligns the text with the center of the image.
  690.  
  691. Alternate Text for Browsers That Can't Display Images
  692.  
  693. Some World Wide Web browsers, primarily those that run on VT100 terminals,
  694. cannot display images. The ALT option allows you to specify text to be
  695. displayed when an image cannot be. For example:
  696.  
  697.     <IMG SRC = "UpArrow.gif" ALT = "Up">
  698.  
  699. where UpArrow.gif is the picture of an upward pointing arrow. With NCSA
  700. Mosaic and other graphics-capable viewers, the user sees the up arrow
  701. graphic. With a VT100 browser, such as lynx, the user sees the word ``Up.''
  702.  
  703. External Images, Sounds, and Animations
  704.  
  705. You may want to have an image open as a separate document when a user
  706. activates a link on either a word or a smaller, in-line version of the image
  707. included in your document. This is considered an external image and is
  708. useful if you do not wish to slow down the loading of the main document with
  709. large in-line images.
  710.  
  711. To include a reference to an external image, use
  712.  
  713.     <A HREF = image_URL>link anchor</A>
  714.  
  715. Use the same syntax is for links to external animations and sounds. The only
  716. difference is the file extension of the linked file. For example,
  717.  
  718. <A HREF = "QuickTimeMovie.mov">link anchor</A>
  719.  
  720. specifies a link to a QuickTime movie. Some common file types and their
  721. extensions are:
  722.  
  723. File Type
  724.      Extension
  725. Plain text
  726.      .txt
  727. HTML document
  728.      .html
  729. GIF image
  730.      .gif
  731. TIFF image
  732.      .tiff
  733. XBM bitmap image
  734.      .xbm
  735. JPEG image
  736.      .jpg or .jpeg
  737. PostScript file
  738.      .ps
  739. AIFF sound
  740.      .aiff
  741. AU sound
  742.      .au
  743. QuickTime movie
  744.      .mov
  745. MPEG movie
  746.      .mpeg or .mpg
  747.  
  748. Make sure your intended audience has the necessary viewers. Most UNIX
  749. workstations, for instance, cannot view QuickTime movies.
  750.  
  751. Troubleshooting
  752.  
  753. Avoid Overlapping Tags
  754.  
  755. Consider this snippet of HTML:
  756.  
  757.     <B>This is an example of <DFN>overlapping</B> HTML tags.</DFN>
  758.  
  759. The word ``overlapping'' is contained within both the <B> and <DFN> tags.
  760. How does the browser format it? You won't know until you look, and different
  761. browsers will likely react differently. In general, avoid overlapping tags.
  762.  
  763. Embed Anchors and Character Tags, But Nothing Else
  764.  
  765. It is acceptable to embed anchors within another HTML element:
  766.  
  767.     <H1><A HREF = "Destination.html">My heading</A></H1>
  768.  
  769. Do not embed a heading or another HTML element within an anchor:
  770.  
  771.     <A HREF = "Destination.html">
  772.     <H1>My heading</H1>
  773.     </A>
  774.  
  775. Although most browsers currently handle this example, it is forbidden by the
  776. official HTML and HTML+ specifications, and will not work with future
  777. browsers.
  778.  
  779. Character tags modify the appearance of other tags:
  780.  
  781.     <UL><LI><B>A bold list item</B>
  782.         <UL>
  783.         <LI><I>An italic list item</I>
  784.     </UL>
  785.  
  786. However, avoid embedding other types of HTML element tags. For example, it
  787. is tempting to embed a heading within a list, in order to make the font size
  788. larger:
  789.  
  790.     <UL><LI><H1>A large heading</H1>
  791.         <UL>
  792.         <LI><H2>Something slightly smaller</H2>
  793.     </UL>
  794.  
  795. Although some browsers, such as NCSA Mosaic for the X Window System, format
  796. this construct quite nicely, it is unpredictable (because it is undefined)
  797. what other browsers will do. For compatibility with all browsers, avoid
  798. these kinds of constructs.
  799.  
  800. What's the difference between embedding a <B> within a <LI> tag as opposed
  801. to embedding a <H1> within a <LI>? This is again a question of SGML. The
  802. semantic meaning of <H1> is that it's the main heading of a document and
  803. that it should be followed by the content of the document.Thus it doesn't
  804. make sense to find a <H1> within a list.
  805.  
  806. Character formatting tags also are generally not additive. You might expect
  807. that
  808.  
  809.     <B><I>some text</I></B>
  810.  
  811. would produce bold-italic text. On some browsers it does; other browsers
  812. interpret only the innermost tag (here, the italics).
  813.  
  814. Check Your Links
  815.  
  816. When an <IMG> tag points at an image that does not exist, a dummy image is
  817. substituted. When this happens, make sure that the referenced image does in
  818. fact exist, that the hyperlink has the correct information in the URL, and
  819. that the file permission is set appropriately (world-readable).
  820.  
  821. A Longer Example
  822.  
  823. Here is a longer example of an HTML document:
  824.  
  825.     <HEAD>
  826.     <TITLE>A Longer Example</TITLE>
  827.     </HEAD>
  828.     <BODY>
  829.     <H1>A Longer Example</H1>
  830.     This is a simple HTML document. This is the first
  831.     paragraph. <P>
  832.     This is the second paragraph, which shows special effects.  This is a
  833.     word in <I>italics</I>.  This is a word in <B>bold</B>.
  834.     Here is an in-lined GIF image: <IMG SRC = "myimage.gif">.
  835.     <P>
  836.     This is the third paragraph, which demonstrates links.  Here is
  837.     a hypertext link from the word <A HREF = "subdir/myfile.html">foo</A>
  838.     to a document called "subdir/myfile.html". (If you
  839.     try to follow this link, you will get an error screen.) <P>
  840.     <H2>A second-level header</H2>
  841.     Here is a section of text that should display as a
  842.     fixed-width font: <P>
  843.     <PRE>
  844.         On the stiff twig up there
  845.         Hunches a wet black rook
  846.         Arranging and rearranging its feathers in the rain ...
  847.     </PRE>
  848.     This is a unordered list with two items: <P>
  849.     <UL>
  850.     <LI> cranberries
  851.     <LI> blueberries
  852.     </UL>
  853.     This is the end of my example document. <P>
  854.     <ADDRESS>Me (me@mycomputer.univ.edu)</ADDRESS>
  855.     </BODY>
  856.  
  857. Click here to see the formatted version.
  858.  
  859. In addition to tags already discussed, this example also uses the <HEAD> ...
  860. </HEAD> and <BODY> ... </BODY> tags, which separate the document into
  861. introductory information about the document and the main text of the
  862. document. These tags don't change the appearance of the formatted document
  863. at all, but are useful for several purposes (for example, NCSA Mosaic for
  864. Macintosh 2.0, for example, allows you to browse just the header portion of
  865. document before deciding whether to download the rest), and it is
  866. recommended that you use these tags.
  867.  
  868. For More Information
  869.  
  870. This guide is only an introduction to HTML and not a comprehensive
  871. reference. Below are additional sources of information.
  872.  
  873. Fill-out Forms
  874.  
  875. One major feature not discussed here is fill-out forms, which allows users
  876. to return information to the World Wide Web server. For information on
  877. fill-out forms, look at this Fill-out Forms Overview
  878.  
  879. Style Guides
  880.  
  881. The following offer advice on how to write ``good'' HTML:
  882.  
  883.    *  Composing Good HTML
  884.    *  CERN's style guide for online hypertext
  885.  
  886. Other Introductory Documents
  887.  
  888. These cover similar information as this guide:
  889.  
  890.    *  How to Write HTML Files
  891.    *  Introduction to HTML
  892.  
  893. Additional References
  894.  
  895.    *  The HTML Quick Reference Guide, which provides a comprehensive listing
  896.      of HTML codes
  897.    *  The official HTML specification
  898.    * A description of SGML, the Standard Generalized Markup Language
  899.    *  The HTML Working Group of the IETF.
  900.  
  901. ----------------------------------------------------------------------------
  902. National Center for Supercomputing Applications / pubs@ncsa.uiuc.edu
  903.